package com.shop.loan.model;

import lombok.Getter;
import lombok.Setter;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.ChoiceType;
import xyz.erupt.annotation.sub_field.sub_edit.DateType;
import xyz.erupt.annotation.sub_field.sub_edit.VL;
import xyz.erupt.jpa.model.BaseModel;

import javax.persistence.*;
import java.util.Date;

@Erupt(
        name = "用户紧急联系人"
)
@Table(name = "s_user_contact")
@Entity
@Getter
@Setter
public class UserContact extends BaseModel {

//    @ManyToOne
//    @JoinColumn(name = "rental_user_id")
//    private RentalUser rentalUser;

    @Column(name = "user_id")
    private Long userId;

    @EruptField(
            views = @View(title = "紧急联系人姓名"),
            edit = @Edit(
                    title = "紧急联系人姓名"
            )
    )
    private String name;

    @EruptField(
            views = @View(title = "紧急联系人电话"),
            edit = @Edit(
                    title = "紧急联系人电话"
            )
    )
    private String mobile;


    @EruptField(
            views = @View(title = "紧急联系人关系"),
            edit = @Edit(
                    title = "紧急联系人关系",
                    type = EditType.CHOICE,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(label = "父母", value = "1"),
                                    @VL(label = "子女", value = "2"),
                                    @VL(label = "兄弟姐妹", value = "3"),
                                    @VL(label = "朋友", value = "4"),
                                    @VL(label = "配偶", value = "5"),
                                    @VL(label = "亲戚", value = "6"),
                                    @VL(label = "同学", value = "7"),
                                    @VL(label = "同事", value = "8"),
                                    @VL(label = "其他", value = "9"),
                            }
                    ))
    )
    private Integer relation;


    @EruptField(
            views = @View(title = "创建时间"),
            edit = @Edit(
                    title = "创建时间",
                    dateType = @DateType(type = DateType.Type.DATE_TIME)
            )
    )
    private Date createTime;

}
